using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;
using FikriKibar.Entities.Concrete;

namespace FikriKibar.DataAccess.Mapping
{
    public class SettingHistoryMapping : EntityTypeConfiguration<SettingHistory>
    {
        public SettingHistoryMapping()
            : this("dbo")
        {
        }
 
        public SettingHistoryMapping(string schema)
        {
            ToTable(schema + ".SettingHistory");
            HasKey(x => x.Id);

            Property(x => x.Id).HasColumnName("Id").IsRequired().HasColumnType("int").HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity);
            Property(x => x.SettingId).HasColumnName("SettingId").IsRequired().HasColumnType("int");
            Property(x => x.SettingKey).HasColumnName("SettingKey").IsRequired().HasColumnType("nvarchar").HasMaxLength(100);
            Property(x => x.SettingValue).HasColumnName("SettingValue").IsRequired().HasColumnType("nvarchar").HasMaxLength(500);
            Property(x => x.CreateDate).HasColumnName("CreateDate").IsRequired().HasColumnType("datetime");
            Property(x => x.CreatedBy).HasColumnName("CreatedBy").IsRequired().HasColumnType("int");
            Property(x => x.UpdateDate).HasColumnName("UpdateDate").IsRequired().HasColumnType("datetime");
            Property(x => x.UpdatedBy).HasColumnName("UpdatedBy").IsRequired().HasColumnType("int");

            Property(x => x.IsDeleted).HasColumnName("IsDeleted").IsRequired().HasColumnType("bit");
        }
    }

}
